<?php

class FileHelper {
  public static function saveExternalFile($url, $managed = FALSE) {
    $directory = file_build_uri(CRABII_IMAGES_DIR);
    if (!file_prepare_directory($directory, FILE_CREATE_DIRECTORY)) {
      // If our directory doesn't exist and can't be created, use the default.
      $directory = NULL;
    }

    return system_retrieve_file($url, $directory, $managed);
  }
}
